package com.zhu.shop.user.service.impl;

import com.zhu.shop.common.Vo.Result;
import com.zhu.shop.common.Vo.user.UserVo;
import com.zhu.shop.user.mapper.UserMapper;
import com.zhu.shop.user.pojo.User;
import com.zhu.shop.user.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl  implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public Result<UserVo> findUser(Long id) {
        User user = userMapper.selectById(id);
        if(null==user){
            return Result.fail(10001,null);
        }
        UserVo userVo=new UserVo();
        BeanUtils.copyProperties(user,userVo);
        return Result.success(userVo);
    }
}
